export default function request(url,data,method='get'){
  return new Promise((resolve,reject)=>{
    wx.request({
      url: "http://localhost:3000" +url,
      data,
      method,
      header:{
        cookie:wx.getStorageSync('cookie') && wx.getStorageSync('cookie').join(';')
      },  
      success (res) {
        if(data.isLogin){
          wx.setStorageSync('cookie', res.cookies)
        }
        resolve(res.data)
      },
      fail:(err)=>{
        reject(err)
      }
    })
  })
}